Component({
  data: {
    selected: 0,
    color: "#646566",
    selectedColor: "#1989fa",
    list: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "/images/home.png",
        "selectedIconPath": "/images/home-active.png"
      },
      {
        "pagePath": "/pages/search/search",
        "text": "搜索",
        "iconPath": "/images/search.png",
        "selectedIconPath": "/images/seach_active.png"
      },
      {
        "pagePath": "/pages/shopCar/shopCar",
        "text": "购物车",
        "iconPath": "/images/shopcar.png",
        "selectedIconPath": "/images/shopcar-active.png"
      },
      {
        "pagePath": "/pages/member/member",
        "text": "会员",
        "iconPath": "/images/member.png",
        "selectedIconPath": "/images/member-active.png"
      }
    ]
  },
  attached() {
    
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  },
 
    pageLifetimes: {
      show() {
        if (typeof this.getTabBar === 'function' &&
          this.getTabBar()) {
          this.getTabBar().setData({
            selected: 0
          })
        }
      }
    }
  
})